! Configuration File for keepalived

pvsadm -Lnglobal_defs {
   router_id {{ router_id }}
}

vrrp_instance web {
    state {{ state }}
    interface ens33
    virtual_router_id 51
    priority {{ priority }}
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 123456
    }
    virtual_ipaddress {
    	{{ virtual_ipaddress }}
    }
}

virtual_server {{ virtual_ipaddress }} {{ port }} {
    delay_loop 6
    lb_algo rr
    lb_kind DR
    protocol TCP

    real_server {{ real_server01 }} {{ port }} {
        weight 1
		TCP_CHECK {
			port {{ port }}
			connect_timeout 3
			nb_get_retry 3
			delay_before_retry 3
        }
    }
    real_server {{ real_server02 }} {{ port }} {
        weight 1
        TCP_CHECK {
            port {{ port }}
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    }
}
